/**
 * @projectName gs_online
 * @package com.answer.wx.gateway.service.impl
 * @className com.answer.wx.gateway.service.impl.NewsServiceImpl
 */
package com.answer.wx.gateway.service.impl;

import com.answer.wx.common.response.ResponseListEntity;
import com.answer.wx.dao.mapper.*;
import com.answer.wx.dao.model.*;
import com.answer.wx.gateway.bean.MessageBean;
import com.answer.wx.gateway.service.NewsService;
import com.answer.wx.gateway.service.UserService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * NewsServiceImpl
 * @description 信息接口实现类
 * @author answer_wx
 * @date 2022/8/7 22:11
 * @version 1.0
 */
@Service
@Slf4j
public class NewsServiceImpl implements NewsService {
    @Autowired
    private SwiperMapper swiperMapper;
    @Autowired
    private ShopMapper shopMapper;
    @Autowired
    private CategorMapper categorMapper;
    @Autowired
    private NoticeMapper noticeMapper;

    @Override
    public ResponseListEntity<Swiper> getAllSwiper() {
        ResponseListEntity<Swiper> entity = ResponseListEntity.newInstance();
        entity.setList(swiperMapper.selectAll());
        entity.setHasNext(false);
        return entity;
    }

    @Override
    public ResponseListEntity<Shop> getAllShop() {
        ResponseListEntity<Shop> entity = ResponseListEntity.newInstance();
        PageHelper.offsetPage(0,3);
        entity.setList(shopMapper.selectAll());
        entity.setHasNext(false);
        return entity;
    }

    @Override
    public ResponseListEntity<Categor> getAllCategory() {
        ResponseListEntity<Categor> entity = ResponseListEntity.newInstance();
        entity.setList(categorMapper.selectAll());
        entity.setHasNext(false);
        return entity;
    }

    @Override
    public ResponseListEntity<Notice> getAllNotice() {
        ResponseListEntity<Notice> entity = ResponseListEntity.newInstance();
        entity.setList(noticeMapper.selectAll());
        entity.setHasNext(false);
        return entity;
    }
}